package com.jy.rhin.infra.repo.notfication.topic.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jy.rhin.domain.notification.topic.entity.TopicQueryVO;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author WeiQ
 * @date 2022/6/28 17:10
 */
@Data
@TableName("t_notification_topic_query")
@NoArgsConstructor
public class TopicQueryPO {

    public TopicQueryPO(TopicQueryVO topicQuery, String topicExp) {
        this.topicExp = topicExp;
        this.queryExp = topicQuery.getQueryExp();
        this.queryName = topicQuery.getQueryName();
        this.iheCode = topicQuery.getIheCode();
    }

    public TopicQueryVO toDO() {
        TopicQueryVO topicQueryVo = new TopicQueryVO();
        topicQueryVo.setQueryExp(this.queryExp);
        topicQueryVo.setQueryName(this.queryName);
        topicQueryVo.setIheCode(this.iheCode);
        return topicQueryVo;
    }

    @TableId
    private Long id;
    /**
     * 主题表达式
     */
    @TableField("topic_exp")
    private String topicExp;
    /**
     * 预存查询函数表达式
     */
    @TableField("query_exp")
    private String queryExp;
    /**
     * 查询方法
     */
    @TableField("query_name")
    private String queryName;
    /**
     * 与IHE对应
     */
    @TableField("ihe_code")
    private String iheCode;
}
